/**
 * 
 */
package de.cbf.cam.dsa.exchange.handler;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.handlers.HandlerUtil;

import de.cbf.cam.dsa.exchange.perspectives.ImportPerspective;

/**
 * @author Stefan Alter
 *
 */
public class OpenImportPerspectiveHandler extends AbstractHandler {

	/**
	 * 
	 */
	public OpenImportPerspectiveHandler() {		
	}

	/* (non-Javadoc)
	 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
	 */
	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
		try {
			window.getWorkbench().showPerspective(ImportPerspective.ID, window);
		} catch (WorkbenchException e) {			
			e.printStackTrace();
		}
		return null;		
	}
}
